home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / infoplus.zip / PAGE_03.INC < prev    next >
Text File  |  1990-06-25  |  6KB  |  223 lines

  1. procedure page_03;
  2.  
  3. const
  4.   EMMint = $67;
  5.   qEMMdrvr = 'EMMXXXX0';
  6.  
  7. var
  8.   EMMarray : array[$000..$3FF] of word;
  9.   xlong : longint;
  10.   xword1 : word;
  11.   xword2 : word;
  12.   xstring : string;
  13.   EMMver, j: byte;
  14.   EMMname: array[1..8] of char;
  15.  
  16. procedure EMMerr(a : byte);
  17.  
  18. begin
  19.   case a of
  20.     $80 : writeln('internal error in EMM software');
  21.     $81 : writeln('malfunction in expanded memory hardware');
  22.     $82 : writeln('memory manager busy');
  23.     $83 : writeln('invalid handle');
  24.     $84 : writeln('undefined function');
  25.     $85 : writeln('no more handles available');
  26.     $86 : writeln('error in save or restore of mapping context');
  27.     $87 : writeln('not enough physical pages available');
  28.     $88 : writeln('not enough free pages available');
  29.     $89 : writeln('no pages requested');
  30.     $8A : writeln('logical page outside range assigned to handle');
  31.     $8B : writeln('invalid physical page number');
  32.     $8C : writeln('page map hardware state save area full');
  33.     $8D : writeln('mapping context already in save area');
  34.     $8E : writeln('mapping context not in save area');
  35.     $8F : writeln('undefined subfunction parameter')
  36.     else
  37.       unknown('expanded memory error', a, 2)
  38.   end
  39. end;
  40.  
  41.   begin (* procedure page_03 *)
  42.   caption2('Total conventional memory (bytes)');
  43.   writeln(DOSmem : 6);
  44.   caption2('Free conventional memory (bytes) ');
  45.   writeln(DOSmem - longint(prefixseg) shl 4 : 6);
  46.   caption2('Extended memory (from BIOS)    ');
  47.   with regs do begin
  48.     AH:=$88;
  49.     intr($15, regs);
  50.     if nocarry then
  51.       writeln(longint(AX) shl 10 : 8)
  52.     else
  53.       writeln('     N/A')
  54.   end;
  55.   caption2('XMS driver present ');
  56.   with regs do
  57.     begin
  58.     AX:=$4300;
  59.     Intr($2F, regs);
  60.     if AL <> $80 then
  61.       Writeln('no')
  62.     else
  63.       begin
  64.       Writeln('yes');
  65.       AX:=$4310;
  66.       Intr($2F, regs);
  67.       xword1:=ES;
  68.       xword2:=BX;
  69.       end
  70.     end;
  71.   caption2('DPMI driver present');
  72.   with regs do
  73.     begin
  74.     AX:=$1687;
  75.     Intr($2F, regs);
  76.     if AL <> 0 then
  77.       Writeln('no')
  78.     else
  79.       begin
  80.       Writeln('yes');
  81.       caption3('version');
  82.       Write(DH, Chr(country[9]), DL);
  83.       caption3('CPU');
  84.       case CL of
  85.         2: Write('286');
  86.         3: Write('386');
  87.         4: Write('486')
  88.       else
  89.         Write('???')
  90.       end;
  91.       caption3('switch mode entry');
  92.       segofs(ES, DI);
  93.       Writeln
  94.       end
  95.     end;
  96.   caption2('Expanded memory');
  97.   if longint(intvec[EMMint]) <> $00000000 then
  98.     begin
  99.     writeln;
  100.     caption3('Interrupt vector');
  101.     xlong:=longint(intvec[EMMint]);
  102.     xword1:=xlong shr 16;
  103.     xword2:=xlong and $0000FFFF;
  104.     segofs(xword1, xword2);
  105.     writeln;
  106.     caption3('Driver');
  107.     xstring:='';
  108.     for i:=$000A to $0011 do
  109.       xstring:=xstring + showchar(chr(mem[xword1 : i]));
  110.     write(xstring);
  111.     if xstring = qEMMdrvr then
  112.       begin
  113.       writeln;
  114.       caption3('Manager status');
  115.       with regs do
  116.         begin
  117.         AH:=$40;
  118.         intr(EMMint, regs);
  119.         if AH = $00 then
  120.           writeln('OK')
  121.         else
  122.           EMMerr(AH);
  123.         caption3('Page frame segment');
  124.         AH:=$41;
  125.         intr(EMMint, regs);
  126.         if AH = $00 then
  127.           writeln(hex(BX, 4))
  128.         else
  129.           EMMerr(AH);
  130.         caption3('Total EMS memory (16K pages)');
  131.         AH:=$42;
  132.         intr(EMMint, regs);
  133.         if AH = $00 then
  134.           writeln(DX : 3)
  135.         else
  136.           EMMerr(AH);
  137.         caption3('Free EMS memory (16K pages) ');
  138.         if AH = $00 then
  139.           writeln(BX : 3)
  140.         else
  141.           EMMerr(AH);
  142.         caption3('EMM version');
  143.         AH:=$46;
  144.         intr(EMMint, regs);
  145.         if AH = $00 then
  146.           writeln(AL shr 4, Chr(country[9]), AL and $0F)
  147.         else
  148.           EMMerr(AH);
  149.         EMMver:=AL shr 4;
  150.         if EMMver >= 4 then
  151.           begin
  152.           caption3('VCPI capable');
  153.           {must make sure 1 page is allocated to be sure that EMS}
  154.           {driver is ON. VCPI is not detectable if EMS driver is OFF}
  155.           {16K of EMS needed for this test to work properly}
  156.           AH:=$43;
  157.           BX:=1;
  158.           Intr(EMMint, regs);
  159.           if AH <> 0 then
  160.             Writeln('error: need 16K available EMS to detect')
  161.           else
  162.             begin
  163.             xword1:=DX; {handle}
  164.             AX:=$DE00;
  165.             Intr(EMMint, regs);
  166.             if AH <> 0 then
  167.               Writeln('no')
  168.             else
  169.               begin
  170.               Write('yes');
  171.               caption3('VCPI version');
  172.               Writeln(BH, Chr(country[9]), BL);
  173.               end;
  174.             AH:=$45; {release our handle}
  175.             DX:=xword1;
  176.             Intr(EMMint, regs)
  177.             end
  178.           end;
  179.         caption1('  Handle   16K pages  Name');
  180.         writeln;
  181.         AH:=$4D;
  182.         ES:=seg(EMMarray);
  183.         DI:=ofs(EMMarray);
  184.         intr(EMMint, regs);
  185.         if AH = $00 then
  186.           if BX > $0000 then
  187.             begin
  188.             window(3, wherey + hi(windmin), twidth, tlength - 2);
  189.             for i:=1 to BX do
  190.               begin
  191.               pause2;
  192.               if endit then
  193.                 Exit;
  194.               write(hex(EMMarray[2 * i - 2], 4), '     ',
  195.                 EMMarray[2 * i - 1] : 3, '        ');
  196.               if EMMver >= 4 then
  197.                 begin
  198.                 AX:=$5300;
  199.                 DX:=EMMarray[2 * i - 2];
  200.                 ES:=Seg(EMMname);
  201.                 DI:=Ofs(EMMname);
  202.                 Intr(EMMint, regs);
  203.                 if AH = 0 then
  204.                   for j:=1 to 8 do
  205.                     if EMMname[j] <> #0 then
  206.                       Write(EMMname[j]);
  207.                 end;
  208.               Writeln;
  209.               end
  210.             end
  211.           else
  212.             writeln('  (no active handles)')
  213.         else
  214.           EMMerr(AH)
  215.         end
  216.       end
  217.     else
  218.       dontknow
  219.     end
  220.   else
  221.     writeln('(none)')
  222.   end;
  223.